package com.leyou.item.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leyou.item.dto.SpuDetailDTO;
import com.leyou.item.entitry.SpuDetail;
import com.leyou.item.mapper.SpuDetailMapper;
import com.leyou.item.service.SpuDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpuDetailServiceImpl extends ServiceImpl<SpuDetailMapper, SpuDetail> implements SpuDetailService {
   @Autowired
   private SpuDetailMapper spuDetailMapper;

    @Override
    public List<SpuDetailDTO> listSpuDetailById(Long id) {
        List<SpuDetail> listSpuDetailById = this.spuDetailMapper.selectList(new QueryWrapper<SpuDetail>().eq("spu_id", id));

        return SpuDetailDTO.convertEntityList(listSpuDetailById);
    }
}
